//
// Created by 刘禹晨 on 16/5/26.
// Copyright (c) 2016 刘禹晨. All rights reserved.
//

#import "CBHelper.h"

static CBHelper *_instance = nil;

@implementation CBHelper


+ (CBHelper *)sharedInstance {
    static dispatch_once_t pred = 0;
    dispatch_once(&pred, ^{
        _instance = [[super alloc] init];
    });
    return _instance;
}

+(id)alloc
{
    return [self sharedInstance];
}

- (id)copy
{
    return self;
}

+ (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size {
    CGRect rect = CGRectMake(0, 0, size.width, size.height);
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [color CGColor]);
    CGContextFillRect(context, rect);
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return image;
}
@end